//
// Created by Jisam on 2024/7/27 21:42.
// solve c
#include <bits/stdc++.h>

#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define i64 long long

using namespace std;

const int N = 1e5 + 5;
int  ans = INT_MAX;

void solve() {
    int n;
    cin >> n;
    i64 x ,y;
    cin >> x >> y;
    vector<int> a(n),b(n);
    for(int i = 0 ; i < n ; i ++)cin >> a[i];
    for(int i = 0 ; i < n ; i ++)cin >> b[i];
    sort(a.begin(),a.end(),greater<>());
    sort(b.begin(),b.end(),greater<>());
    ans = n;
    for(int i = 0; i <n ; i ++){
        x -= a[i];
        if(x < 0)ans = min(i + 1, ans);
    }
    for(int i = 0; i <n ; i ++){
        y -= b[i];
        if(y < 0) ans = min(i + 1, ans);
    }

    cout << ans <<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
//    cin >> T;
    while (T--) solve();
//    cout << "\n"[];
    return 0;
}